﻿<%@ Page Title="" Language="VB" MasterPageFile="~/App/Master/App.master" AutoEventWireup="false" CodeFile="Connections.aspx.vb" Inherits="App_Connections" %>


<asp:Content ID="Content1" ContentPlaceHolderID="CphHead" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphMainContent" runat="Server">
    <asp:ScriptManagerProxy runat="server">
        <Scripts>
            <asp:ScriptReference Path="https://www.google.com/jsapi" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <script type="text/javascript">

        google.load('visualization', '1.0', { 'packages': ['geochart'] });
        google.load("visualization", "1", { packages: ["corechart"] });


        $(function () {



            SetUI();
            on_update_panel_server(function () {
                SetUI();
            });

        });

        function SetUI() {

            $(".chosen-select").chosen();

            $("#TxtBeginDate").datepicker({
                dateFormat: 'yy-mm-dd',
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1,
                onClose: function (selectedDate) {
                    $("#TxtEndDate").datepicker("option", "minDate", selectedDate);
                }
            });
            $("#TxtEndDate").datepicker({
                dateFormat: 'yy-mm-dd',
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1,
                onClose: function (selectedDate) {
                    $("#TxtBeginDate").datepicker("option", "maxDate", selectedDate);
                }
            });


        }

        function DrawChartPostSend(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var options = {
                chartArea: { left: '8%', top: '5%', width: "80%", height: "80%" },
                focusTarget: 'category',
                lineWidth: 3, pointSize: 7, curveType: '',
                hAxis: { slantedText: false, maxAlternation: 1, maxTextLines: 1 },
                series: [
                    { targetAxisIndex: 0, color: '#29ABE2' },
                    { targetAxisIndex: 1, color: '#67B203' }
                ],
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }
            };

            var chart = new google.visualization.LineChart(document.getElementById('chart_div_post_send'));
            chart.draw(data, options);

        }

        function DrawChartPostSend2(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var formatter = new google.visualization.NumberFormat({ suffix: '%', fractionDigits: 0 });
            formatter.format(data, 2);


            var options = {
                chartArea: { left: '8%', top: '5%', width: "90%", height: "80%" },
                focusTarget: 'category',
                isStacked: false,
                hAxis: { slantedText: false, minTextSpacing: 0, maxAlternation: 1, maxTextLines: 1 },
                vAxes: [{ textPosition: 'out' }, { textPosition: 'out' }],
                series: [
                    { targetAxisIndex: 0, color: '#ff6a00', type: 'bars' },
                    { targetAxisIndex: 1, color: '#7CCBED', type: 'bars' }
                ],
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }
            };

            var chart = new google.visualization.ComboChart(document.getElementById('chart_div_post_send2'));
            chart.draw(data, options);

        }

        function DrawChartAutoFollow(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var options = {
                chartArea: { left: '8%', top: '5%', width: "90%", height: "80%" },
                focusTarget: 'category',
                isStacked: true,
                hAxis: { slantedText: false, minTextSpacing: 0, maxAlternation: 1, maxTextLines: 1 },
                series: [
                    { color: '#C1272D', type: 'line', lineWidth: 3, pointSize: 7, curveType: '' },
                    { color: '#67B203', type: 'bars' },
                    { color: '#FFD203', type: 'bars' }
                ], bar: { groupWidth: '80%' },
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }

            };

            var chart = new google.visualization.ComboChart(document.getElementById('chart_auto_foll_div'));
            chart.draw(data, options);
        }

        function DrawChartAutoFollow2(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var options = {
                chartArea: { left: '8%', top: '5%', width: "90%", height: "80%" },
                focusTarget: 'category',
                isStacked: true,
                hAxis: { slantedText: false, minTextSpacing: 0, maxAlternation: 1, maxTextLines: 1 },
                series: [
                    { color: '#C1272D', type: 'line', lineWidth: 3, pointSize: 7, curveType: '' },
                    { color: '#67B203', type: 'bars' },
                    { color: '#FFD203', type: 'bars' }
                ], bar: { groupWidth: '80%' },
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }

            };

            var chart = new google.visualization.ComboChart(document.getElementById('chart_auto_foll_div2'));
            chart.draw(data, options);
        }

    </script>

    <!-- box 1 -->
    <div class="row-fluid">
        <!-- console -->
        <asp:UpdatePanel ID="UpPConsole" runat="server" UpdateMode="Conditional" class="manage">
            <ContentTemplate>
                <div class="well-manage">
                    <!-- filtri -->
                    <div class="well-manage-sx">
                        <div class="top-bar">
                            manage contacts				                
                        </div>
                        <%--                        <div class="manage-sx-top">
                            <div class="manage-message-head">
                                <div>
                                    <asp:LinkButton runat="server" CssClass="bottone-private" ID="RbtSearchLink" Text="contacts" CommandName="CONSOLE_SEARCH" CommandArgument="1" />
                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="bottone-private" ID="RbtSearchHashtag" Text="hashtags" CommandName="CONSOLE_SEARCH" CommandArgument="2" />
                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="bottone-private" ID="RbtSearchAutoFollow" Text="auto-following" CommandName="CONSOLE_SEARCH" CommandArgument="3" />
                                </div>
                            </div>
                        </div>--%>
                        <div class="manage-sx-bottom">
                            <div class="manage-message-head">

                                <asp:TextBox runat="server" ID="TxtBeginDate" CssClass="" Visible="false"></asp:TextBox>
                                <asp:TextBox runat="server" ID="TxtEndDate" CssClass="" Visible="false"></asp:TextBox>


                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDayAll" Text="always" CommandName="CONSOLE_DAY" CommandArgument="all" />
                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay15" Text="15" CommandName="CONSOLE_DAY" CommandArgument="15" />
                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay30" Text="30" CommandName="CONSOLE_DAY" CommandArgument="30" />
                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay60" Text="60" CommandName="CONSOLE_DAY" CommandArgument="60" />

                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay90" Text="90" CommandName="CONSOLE_DAY" CommandArgument="90" />


                                </div>
                                <div><a href="#" class="a-icona5"></a></div>
                            </div>
                            <div class="manage-input">
                                <label>user name</label>
                                <asp:TextBox runat="server" ID="TxtUsername" placeholder="@username" CssClass=""></asp:TextBox>
                                <label>full name</label>
                                <asp:TextBox runat="server" ID="TxtFullname" placeholder=" " CssClass=""></asp:TextBox>

                                <asp:Panel runat="server" ID="PnlSearchLink">
                                    <label>link</label>
                                    <asp:ListBox runat="server" CssClass="chosen-select" Width="200px" ID="DdlLinkType" />
                                    <label>categoria</label>
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlCategories" SelectionMode="Multiple" />
                                    <label>gender</label>
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlGender" SelectionMode="Multiple" />
                                    <label>Business</label>
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlBusiness" SelectionMode="Multiple" />
                                    <br />
                                    <label>Language</label>
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlLanguage" SelectionMode="Multiple" />
                                    <label>NOT Language</label>
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlLanguageNot" SelectionMode="Multiple" />
                                    <br />
                                    <label>Status</label>
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlStatus" SelectionMode="Multiple" />

                                    <label>Status</label>
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="ListBox1" SelectionMode="Multiple" />
                                    <br />
                                    <label>Verificati</label>
                                    <asp:ListBox runat="server" CssClass="chosen-select" Width="200px" ID="DdlVerified" />

                                    <%--                                    <asp:CheckBox runat="server" ID="ChkVerified" AutoPostBack="false" />
                                    <label for="ChkRangeTime">
                                        <span></span>Verificati
                                    </label>--%>
<%--                                    <hr />
                                    <label>Order by</label>
                                    <asp:ListBox runat="server" CssClass="chosen-select" Width="200px" ID="DdlOrderBy" />--%>

                                </asp:Panel>

                                <%--                                <asp:Panel runat="server" ID="PnlSearchHashtag">
                                    hashtag:
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlHashtag" SelectionMode="Multiple" />
                                </asp:Panel>

                                <asp:Panel runat="server" ID="PnlSearchAutoFollow">
                                    Status:
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlAutoFollStatus" SelectionMode="Multiple" />
                                    Query:
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlAutoFollQuery" SelectionMode="Multiple" />
                                </asp:Panel>--%>
                            </div>
                            <div class="option-search">
                                <asp:LinkButton runat="server" ID="BtnExport" CssClass="bottone-save" Text="search" />
                            </div>
                        </div>
                    </div>

                    <!-- gestione filtri -->
                    <div class="well-manage-dx">
                        <div class="top-bar">
                            filter
                        </div>
                        <div class="manage-dx-left">

                            <asp:TextBox runat="server" ID="TxtNewFilter" CssClass="" placeholder="name your new filter"></asp:TextBox>
                            <div class="option-save">
                                <asp:LinkButton runat="server" CssClass="bottone-save" ID="BtnAddFilter" Text="Add" />
                            </div>
                            <div>
                                <asp:DropDownList runat="server" ID="DdlAccountFilter" AutoPostBack="true" />
                                <asp:LinkButton runat="server" CssClass="bottone-save" ID="BtnSaveFilter" Text="Save" />
                                <asp:LinkButton runat="server" CssClass="a-icona-chiudi" ID="BtnRemoveFilter" />
                            </div>
                        </div>
                        <div class="top-bar">
                            list
                        </div>

                        <div class="manage-dx-left">

                            <asp:DropDownList runat="server" ID="DdlOnLineList" AutoPostBack="false" />
                            <asp:TextBox runat="server" ID="TxtNewList" CssClass="" placeholder="name your new list"></asp:TextBox>
                            <div class="option-save">
                                <asp:LinkButton runat="server" CssClass="bottone-save" ID="BtnAddList" Text="Add" />
                            </div>

                        </div>
                        <!-- fine contenuto -->
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <!-- box 2 -->
    <div class="row-fluid">
        <!-- account collegati -->
        <asp:UpdatePanel ID="UpPAccountConn" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel runat="server" ID="PnlAccountConn" CssClass="found">

                    <!-- account trovati -->
                    <div class="top-bar">
                        <div class="top-found">
                            found:
                    <asp:Label runat="server" ID="LblUserFound" CssClass="found-count" />
                        </div>
                        <div class="option-xml-export">
                            <a class="bottone-export" href="#">xml export</a>
                        </div>
                    </div>
                    <!-- lista account -->
                    <div class="well-found">


                        <asp:ListView runat="server" ID="ListAccountConn" ClientIDMode="Predictable">
                            <LayoutTemplate>
                                <div class="found-head">
                                    <div class="found-head-avatar">
                                        <asp:LinkButton runat="server" CssClass="found-head-title" CommandName="sort" CommandArgument="rank">rank</asp:LinkButton>

                                    </div>
                                    <div class="found-head-bio"><a href="#" class="found-head-title">bio</a></div>
                                    <div class="found-head-tweets">
                                        <asp:LinkButton runat="server" CssClass="found-head-title" CommandName="sort" CommandArgument="post_count">tweets</asp:LinkButton>
                                    </div>
                                    <div class="found-head-following">
                                        <asp:LinkButton runat="server" CssClass="found-head-title" CommandName="sort" CommandArgument="friend_count">following</asp:LinkButton>
                                    </div>
                                    <div class="found-head-follower">
                                        <asp:LinkButton runat="server" CssClass="found-head-title" CommandName="sort" CommandArgument="follower_count">follower</asp:LinkButton>
                                    </div>
                                    <div class="found-head-gender"><a href="#" class="found-head-title">gender/type</a></div>
                                    <div class="found-head-status"><a href="#" class="found-head-title">status</a></div>
                                    <div class="found-head-lang"><a href="#" class="found-head-title">lang.</a></div>
                                    <div class="found-head-auto"><a href="#" class="found-head-title">auto-follow.</a></div>
                                    <div class="found-head-category"><a href="#" class="found-head-title">category</a></div>
                                </div>
                                <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
                            </LayoutTemplate>
                            <ItemTemplate>
                                <div class="found-cont">
                                    <ul>
                                        <li class="found-head-avatar">
                                            <div class="icona-foto-mention">
                                                <img src="<%# eval("avatar") %>" />
                                                <asp:Image runat="server" Visible='<%# eval("verified") %>' ImageUrl="https://si0.twimg.com/help/1307051362_737" Style="top: -56px; position: relative; float: right;" />
                                            <div style="width: 13px;top: -11px; left: -11px; position: relative; float: right; border: 1px solid #333333; padding: 0px 1px 0px 3px; background-color: #ff3;"><%# UI.Print.Num0(Math.Min(Math.Max(Eval("rank"), 1), 100))%></div>
                                            </div>
                                            <div>
                                                <asp:CheckBox runat="server" ID="ChkExcluded" Checked='<%# Eval("excluded")%>' ClientIDMode="Predictable" AutoPostBack="true" OnCheckedChanged="ChkExcluded_CheckedChanged" />
                                                <label for="CphMainContent_ListAccountConn_ChkExcluded_<%# Container.DisplayIndex%>" class="tooltip" title="Exclude"><span></span></label>
                                            </div>

                                        </li>
                                        <li class="found-head-bio">

                                            <div class="content-tweet">
                                                <div class="titolo-count"><span class="weevo">@<%# Eval("username")%></span> <%# eval("fullname") %></div>
                                                <div class="testo-count"><%# Eval("description")%></div>
                                            </div>
                                            <div class="counter-tweet">
                                                <div class="connection-state">
                                                    <%# eval("location") %>
                                                </div>
                                                <div class="connection-link">
                                                    <%# Eval("url")%>
                                                </div>


                                                <div class="ok-dm">
                                                    <div>
                                                        <asp:LinkButton runat="server" CssClass="a-icona1 tooltip" title="Follow/unfollow this user" ID="BtnFollowPrivate" CommandName="FOLLOW" Text="" />
                                                    </div>
                                                    <div>
                                                        <asp:Label runat="server" ID="LblFollowerPrivate" CssClass="a-icona2 tooltip" Text="" title="If active, this user is following you"></asp:Label>
                                                    </div>
                                                    <div><a href="#" class="a-icona3 tooltip" title="Tips Icon"></a></div>
                                                </div>
                                            </div>


                                        </li>
                                        <li class="found-head-tweets"><%# UI.Print.Num0(Eval("post_count"))%></li>
                                        <li class="found-head-following"><%# UI.Print.Num0(Eval("friend_count"))%></li>
                                        <li class="found-head-follower"><%# UI.Print.Num0(Eval("follower_count"))%></li>
                                        <li class="found-head-gender">
                                            <div class="inactive-img">
                                                <img src="/style/app/img/<%# Me.GetImageGenderType(Eval("business_type_id"), Eval("gender_type_id"))%>" title="<%# Eval("Post_Hours_Json") %>">
                                                <%--                                                <%# mDB.Account.CalculateActivityCoeff(mDB.Account.GetActivityHours(Eval("Post_Hours_Json")))%>
                                                <br />
                                                <%# Me.calc2(mDB.Account.GetActivityHours(Eval("Post_Hours_Json")))%>
                                                <br />
                                                <%# Me.calc3(mDB.Account.GetActivityHours(Eval("Post_Hours_Json")))%>--%>
                                                <br />

                                                <%# mDB.Account.CalculateActivityCoeff(mDB.Account.GetActivityHours(Eval("Post_Hours_Json")))%> - 
                                                
                                                <br />

                                            </div>
                                        </li>
                                        <li class="found-head-status">
                                            <div class="good-img">
                                                <img src="/style/app/img/<%# Me.GetImageStatus(Eval("status_type_id"))%>">
                                            </div>
                                        </li>
                                        <li class="found-head-lang"><%# Eval("lang") %></li>
                                        <li class="found-head-auto">#startup</li>
                                        <li class="found-head-category">
                                            <asp:Label runat="server" ID="LblCats"></asp:Label></li>
                                    </ul>
                                </div>

                            </ItemTemplate>
                        </asp:ListView>
                        <App:DataPager runat="server" ID="DPAccountConn" Controlid="ListAccountConn" PageSize="20" OnPageChanged="SetDataAccountList"
                            SortField="friend_count" SortType="Descending" CssActive="found-head-title-a" CssNotActive="found-head-title" />




                    </div>
                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>



    </div>


</asp:Content>
